<template>
  <div>
    <h3>新闻列表</h3>
    <ul class="mui-table-view">
      <li class="mui-table-view-cell mui-media" v-for="item in newList" :key="item.id">
        <router-link :to="'/home/newInfo/' + item.id"><!-- 由于我没有数据 所以 完整写法是 :to="'/home/newInfo' + item.id"-->
          <img class="mui-media-object mui-pull-left" src="item.img">
          <div class="mui-media-body">
            <h1>幸福</h1>
            <!-- 需要些的内容 用插值表达式代替  -->
            <p class="mui-ellipsis">
              <span>发表时间：2012-12-12 12：12:12</span>
              <span>点击：0次</span>
            </p>
          </div>
        </router-link>
      </li>
    </ul>
  </div>
</template>
<style lang="scss" scoped>
.mui-table-view {
  li {
    h1 {
      font-size: 13px;
    }
    .mui-ellipsis {
      font-size: 12px;
      color: #226aff;
      display: flex;
      justify-content: space-between;
    }
  }
}
</style>
<script>
import { Toast } from "mint-ui"
export default {
  data() {
    return {
      newList: []
    };
  },
  created() {
    // this.getNewList();
  },
  methods: {
    getNewList() {
      this.$http.get("http://www.liulongbin.top:3005/api/getlunbo").then(result => {
        // console.log('result')
        if (result.body.status === 0 ) {
          console.log(result);
          this.newList = result.body.message;
        } else {
          Toast("获取新闻列表失败");
        }
      });
    }
  }
};
</script>

